1. Inspect the drive-queue element for a mounted drive to determine which driver the dQRefNum points to. Then, inspect the driver's name. If the name is ".AppleCD", it's probably a CD-ROM drive.
This approach fails for non-Apple CD-ROM drives, since they have different driver names.
2. Inspect the drive's attributes in the four bytes preceding the drive-queue entry. If the drive is "locked in hardware" and is removable, it's probably a CD-ROM drive.
This approach can also fail in some configurations, since locked removable hard disks, optical media, and even diskettes can have the same attributes.
3. Issue a SCSI request directly to the drive.
This fails for some early CD-ROM drives (non-SCSI-2 compliant). Before SCSI-2, there was no CD-ROM device type defined, and some CD-ROM drives reported that they were hard disks. There is an additional complication introduced by SCSI Manager 4.3, and IDE CD-ROM drives require a completely different calling architecture.
4. Issue a ReadTOC() call to the driver, and inspect the result that is returned.
Although Control() with csCode 100 is a well-known CD-ROM driver call, there is nothing to prevent other drivers from using this call. Although few do, it is entirely possible for a non-CD-ROM driver to implement this call with different values in csParam, which could be disastrous.
The fourth approach is probably the most reliable. For each mounted drive, issue a ReadTOC call to the driver for that drive. If reasonable results are returned, you probably have a CD-ROM drive.
TechNote DV 22 on CD ROM Driver Calls
SCSI Manager 4.3 chapter in Inside Macintosh: Devices.
Developer Note on Quadra 630, IDE Manager.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help